<template>
  <div class="main-header">
    <div class="menu-icon" @click="handleMenuIconClick">
      <el-icon size="20">
        <component :is="isFold ? 'Expand' : 'Fold'" />
      </el-icon>
    </div>
    <div class="content">
      <header-crumb />
      <header-info />
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref } from 'vue'
  import headerInfo from './components/header-info.vue'
  import headerCrumb from './components/header-crumb.vue'

  const $emit = defineEmits(['foldChange'])

  const isFold = ref<Boolean>(false)
  function handleMenuIconClick() {
    isFold.value = !isFold.value
    $emit('foldChange', isFold.value)
  }
</script>

<style lang="scss" scoped>
  .main-header {
    display: flex;
    align-items: center;
    height: 100%;
    .menu-icon {
      display: flex;
      align-items: center;
      cursor: pointer;
    }
    .content {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex: 1;
      padding: 0 18px;
    }
  }
</style>
